#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:homework2_7.py
# author:wmf
# datetime:2021/4/4 23:34
# software: PyCharm
'''
this is function description
'''
# import module your need

#7  随机生成20个学生的成绩; 判断这20个学生成绩的等级; 用函数来实现;
#    A---成绩>=90;
#    B-->成绩在 [80,90)
#    C-->成绩在 [70,80)
#    D-->成绩<70

from random import randint
def JudgeScore(dict1):
    dict2 = {}
    for key,value in dict1.items():
        if(value >= 90):
            dict2[key] = 'A'
        elif(value >=80 and value <90):
            dict2[key] = 'B'
        elif(value >=70 and value <80):
            dict2[key] = 'C'
        else:
            dict2[key] = 'D'
    return dict2

dict1 ={}
li = [chr(i) for i in range(ord('a'),ord('t')+1)]
for x in li:
    dict1[x] = randint(50,100)

print("20个学生的分数为:")
print(dict1)
print("20个学生的等级为:")
print(JudgeScore(dict1))


